#include <stdio.h>

struct student {
    char name[50];
    int scroe; 
};


void swap(struct student* a, struct student* b) {
    struct student t;
    t = *a;
    *a = *b;
    *b = t;
}


void sortStructStudents(struct student* a, int len) {
    int i, j;
    for (i = 0; i < len - 1; ++i) {
        for (j = i + 1; j < len; ++j) {
            if (a[i].scroe < a[j].scroe) {
                swap((a + i), (a + j));
            }
        }
    }
}

int main() {
    
    struct student students[] = {
        {"Alice", 85},
        {"Bob", 92},
        {"Charlie", 78},
        {"David", 90}
    };
    int len = sizeof(students) / sizeof(students[0]);

   
    printf("Before sorting:\n");
    for (int i = 0; i < len; i++) {
        printf("%s: %d\n", students[i].name, students[i].scroe);
    }

    
    sortStructStudents(students, len);

    
    printf("\nAfter sorting:\n");
    for (int i = 0; i < len; i++) {
        printf("%s: %d\n", students[i].name, students[i].scroe);
    }

    return 0;
}
} 